<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <!-- 隐藏字段：当前教学点ID -->
    <input type="hidden" id="current-ocation-id" value="{$ocation_id|default=0}">
    <!-- 隐藏字段：row数据，供JavaScript使用 -->
    <input type="hidden" id="row" value='{:json_encode($row ?? [])}'>
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">编辑消息</h3>
        </div>
        <div class="panel-body">
            <div class="col-md-12">
                <div class="form-group">
                    <label for="c-title" class="control-label col-xs-12 col-sm-2">标题:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-title" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}" data-rule="required" data-tip="请输入标题">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-message_type" class="control-label col-xs-12 col-sm-2">消息类型:</label>
                    <div class="col-xs-12 col-sm-8">
                        <select id="c-message_type" class="form-control" name="row[message_type]" data-rule="required">
                            <option value="">请选择消息类型</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-push_type" class="control-label col-xs-12 col-sm-2">推送方式:</label>
                    <div class="col-xs-12 col-sm-8">
                        <div class="radio-inline">
                            <label for="c-push_type-1">
                                <input id="c-push_type-1" name="row[push_type]" type="radio" value="1" data-rule="required" {if $row.push_type=='1'}checked{/if}> 单发
                            </label>
                        </div>
                        <div class="radio-inline">
                            <label for="c-push_type-2">
                                <input id="c-push_type-2" name="row[push_type]" type="radio" value="2" data-rule="required" {if $row.push_type=='2'}checked{/if}> 群发
                            </label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-content" class="control-label col-xs-12 col-sm-2">内容:</label>
                    <div class="col-xs-12 col-sm-8">
                        <textarea id="c-content" class="form-control editor" name="row[content]" data-rule="required">{$row.content|htmlentities}</textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-quick_link" class="control-label col-xs-12 col-sm-2">快捷链接:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input id="c-quick_link" class="form-control" name="row[quick_link]" type="text" value="{$row.quick_link|htmlentities}" placeholder="请输入快捷链接URL">
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-booking_project" class="control-label col-xs-12 col-sm-2">预约报名项目:</label>
                    <div class="col-xs-12 col-sm-8">
                        <select id="c-booking_project" class="form-control" name="row[booking_project]">
                            <option value="">请选择预约报名项目</option>
                            <option value="1" {if $row.booking_project=='1'}selected{/if}>项目一</option>
                            <option value="2" {if $row.booking_project=='2'}selected{/if}>项目二</option>
                            <option value="3" {if $row.booking_project=='3'}selected{/if}>项目三</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-form_type" class="control-label col-xs-12 col-sm-2">表单类型:</label>
                    <div class="col-xs-12 col-sm-8">
                        <div class="radio-inline">
                            <label for="c-form_type-1">
                                <input id="c-form_type-1" name="row[form_type]" type="radio" value="1" {if $row.form_type=='1' || !$row.form_type}checked{/if}> 无表单
                            </label>
                        </div>
                        <div class="radio-inline">
                            <label for="c-form_type-2">
                                <input id="c-form_type-2" name="row[form_type]" type="radio" value="2" {if $row.form_type=='2'}checked{/if}> 有表单
                            </label>
                        </div>
                    </div>
                </div>
                <div class="form-group" id="form-design-area" style="display: {if $row.form_type=='2'}block{else}none{/if};">
                    <label class="control-label col-xs-12 col-sm-2">表单设计:</label>
                    <div class="col-xs-12 col-sm-8">
                        <div id="form-fields-container">
                            <!-- 表单字段将在这里动态添加 -->
                        </div>
                        <button type="button" class="btn btn-info btn-sm" id="add-form-field">
                            <i class="fa fa-plus"></i> 添加字段
                        </button>
                        <input type="hidden" name="row[form_config]" id="form-config-data" value="{$row.form_config|htmlentities}">
                    </div>
                </div>
               <!--接收者 receiver_id-->
                <div class="form-group">
                    <label for="c-receiver_id" class="control-label col-xs-12 col-sm-2">接收者:</label>
                    <div class="col-xs-12 col-sm-8">
                        <select id="c-receiver_id" class="form-control" name="row[receiver_id][]" data-rule="required" multiple="true" style="height: 300px;">
                            <option value="">请选择接收者</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-status" class="control-label col-xs-12 col-sm-2">状态:</label>
                    <div class="col-xs-12 col-sm-8" id="div-status">
                        <input id="c-status" name="row[status]" type="hidden" value="{$row.status}">
                        <a href="javascript:;" data-toggle="switcher" class="btn-switcher {if $row.status=='1'}active{else}text-gray{/if}" data-input-id="c-status" data-yes="1" data-no="0">
                            <i class="fa fa-toggle-on fa-2x {if $row.status!='1'}fa-flip-horizontal{/if}"></i>
                        </a>
                        <div data-favisible="switch=1" class="p-3">正常</div>
                        <div data-favisible="switch=0" class="p-3">隐藏</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group layer-footer">
            <label class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-8">
                <button type="submit" class="btn btn-success btn-embossed disabled">{:__("OK")}</button>
                <button type="button" class="btn btn-primary" id="btn-send-now">立即发送</button>
                <button type="reset" class="btn btn-default btn-embossed">{:__("Reset")}</button>
            </div>
        </div>
    </div>
</form>

